<?php

class course_categories {
	
	function __construct() {
		
	}
	
	function __destruct() {
		
	}
	
	function get_courses_categories($parent_id) {
		global $DB;
		
		$sql = file_get_contents(__DIR__ . '/sql/get_courses_categories.sql');
		$stmt = $DB->prepare($sql);
		$stmt->bind_param('d', $parent_id);
		$stmt->execute();
		
		return $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
	}
	
	function get_courses($parent_id) {
		global $DB;
		
		$sql = file_get_contents(__DIR__ . '/sql/get_courses_names.sql');
		$stmt = $DB->prepare($sql);
		$stmt->bind_param('d', $parent_id);
		$stmt->execute();
		
		return $stmt->get_result()->fetch_all(MYSQLI_ASSOC);
	}
}

?>
